package org.mca.mcaweb.util;

import javax.persistence.EntityManager;

import org.mca.mcaweb.dao.DAO;
import org.mca.mcaweb.dao.JPAUtil;
import org.mca.mcaweb.entity.Usua;
import org.mca.mcaweb.enums.Profile;


/*
 * CREATE ADMINISTRADOR USER 
 */
public class GenerateUser {
	
public static void main(String[] args) {
		
		JPAUtil jpaUtil = new JPAUtil();
		EntityManager em = jpaUtil.getEntityManager();
		
		Usua user = new Usua();
		DAO<Usua> userDAO = new DAO<Usua>(Usua.class , em);
		
		try {
			
			/*
			 * USER INFORMATION
			 */
//			user.setEmail("admin@admin.com");
//			user.setPassword(PasswordHelper.getInstance().encryptMD5("1"));
//			user.setName("admin");
//			user.setCpf("999999");
//			user.setInstitution("CIH");
//			user.setProfile(Profile.CRUD);
//			em.getTransaction().begin();
//			userDAO.save(user);
//			em.getTransaction().commit();
		
			jpaUtil.close(em);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
